package com.gopay.common.user.manager.impl;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.gopay.common.domain.User4Amount;
import com.gopay.common.user.dao.UserDailyBalStatsDAO;
import com.gopay.common.user.manager.UserDailyBalStatsManager;
/**
 * 
 * IUserDailyBalStatsManager实现
 * @UserDailyBalStatsManagerImpl.java
 * @author 曹永峰
 */
@Service("userDailyBalStatsManager")
public class UserDailyBalStatsManagerImpl implements UserDailyBalStatsManager {
	@Resource(name = "userDailyBalStatsDao")
    private UserDailyBalStatsDAO userDailyBalStatsDao;
	
	/**
	 * 保存日终余额统计
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class })
	public void saveBalInfo(List<User4Amount> list) {
		for (User4Amount user4Amount : list) {
			User4Amount ua = userDailyBalStatsDao.getUser4Amount(user4Amount.getAcctId(), user4Amount.getStlmDate());
			if(ua==null){
				userDailyBalStatsDao.save(user4Amount);
			}
			
		}

	}
	@Override
	public List<User4Amount> get(Map<Object, Object> paraMap) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<User4Amount> getAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public User4Amount get(Serializable id) {
		// TODO Auto-generated method stub
		return null;
	}


	public UserDailyBalStatsDAO getUserDailyBalStatsDao() {
		return userDailyBalStatsDao;
	}

	public void setUserDailyBalStatsDao(UserDailyBalStatsDAO userDailyBalStatsDao) {
		this.userDailyBalStatsDao = userDailyBalStatsDao;
	}

}
